package com.wangjie.define.generic.compare;

public class Cat implements Comparable<Cat> {
    private int age;

    public Cat(int age) {
        this.age = age;
    }

    @Override
    public int compare(Cat cat) {
        if(this.age > cat.age) return 1;
        else if (this.age < cat.age) return -1;
        else return 0;
    }

    @Override
    public String toString() {
        return "Cat{" +
                "age=" + age +
                '}';
    }
}
